import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'


Vue.use(Vuex)

const files = require.context("./modules", false, /\.js$/);
const modules = {};
files.keys().forEach((key) => {
  const moduleName = key.replace(/\.\//, "").replace(/\.js/, "");
  const store = files(key).default;
  modules[moduleName] = store;
  modules[moduleName].namespaced = true;
});
const store = new Vuex.Store({
  modules: {
    ...modules,
  },
  getters
})
export default store
